package com.dingwen.treasure.web.excption.handler.impl;

import com.dingwen.treasure.base.exception.BaseExceptionHandler;
import com.dingwen.treasure.base.exception.BusinessException;
import com.dingwen.treasure.base.pojo.vo.Result;
import org.springframework.stereotype.Component;

/**
 * 　BusinessExceptionStateImpl
 * 　@author dingwen
 * 　@date 2022/5/14$
 */
@Component("com.dingwen.treasure.web.exception.BusinessException")
public class BusinessExceptionHandlerImpl extends BaseExceptionHandler {
    /**
     * 根据异常构建统一返回结果
     *
     * @param exception 异常
     * @return result
     */
    @Override
    public Result buildResultByException(Exception exception) {
        BusinessException businessException = (BusinessException) exception;
        return businessException.result();
    }
}
